Skip to content

Conversation

@Pixaurora
Copy link
Contributor

This PR is all in one commit, but relies on #388

Comment on lines +32 to +41
return JsonHelper.toSortedString(encodeResult.getOrThrow(message -> new RuntimeException("expected text to be encodeable")));
}

public static Text fromJson(String json, DynamicRegistryManager registryManager) {
var element = JsonParser.parseString(json);

var ops = RegistryOps.create(JsonOps.INSTANCE, registryManager);
var encodeResult = TextCodecs.CODEC.decode(ops, element);

return encodeResult.getOrThrow(message -> new RuntimeException("expected text to be decodeable")).getFirst();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these exception messages should probably include the error message from the result
minecraft also threw JsonParseExceptions on 1.21.5 which I think is good for specificity

@Pixaurora Pixaurora changed the base branch from 1.21 to 1.21.5 July 24, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants